package com.tvunetworks.center.device.service;

import com.tvunetworks.center.common.model.ExtendExternal;
import com.tvunetworks.center.common.util.Result;
import com.tvunetworks.center.device.constant.CommandConstant;
import com.tvunetworks.center.device.model.json.SetBitrateAndDelayParam;
import com.tvunetworks.center.device.model.param.*;
/**
 * @author Etan Yang
 * @create: 2021/10/13 15:27
 */
public interface ReceiverControlService {
    /**
     *
     * @param userId userId
     * @param userRole userRole
     * @param rid rid
     * @param sourceId sourceId
     * @return  Result
     */
    Result<String> startLive(String userId, String userRole, String rid, String sourceId);

    /**
     *
     * @param userId userId
     * @param userRole userRole
     * @param rid rid
     * @param sourceId sourceId
     * @param type type
     * @return Result
     */
    Result<String> startLiveExtendSource(String userId, String userRole, String rid, String sourceId,String type);

    /**
     *
     * @param userId userId
     * @param userRole userRole
     * @param rid rid
     * @return  Result
     */
    Result<String> stopLive(String userId, String userRole, String rid);

    /**
     *
     * @param param param
     * @return Result
     */
    Result<String> setBitrateAndDelay(SetBitrateAndDelayParam param);

    /**
     *
     * @param rid rid
     * @param operate operate
     * @param data data
     * @return Result
     */
    Result<String> command(String rid, CommandConstant operate, String data);

    /**
     *
     * @param rid rid
     * @param sourceId sourceId
     * @return Result
     */
    Result<String> startLiveForAPI(String rid, String sourceId);

    /**
     *
     * @param rid rid
     * @param sid sid
     * @return Result
     */
    Result<String> stopLiveForAPI(String rid, String sid);

//  Result<String> sendCommandToReceiver(String rId, CommandConstant command, String data);

    /**
     *
     * @param userId userId
     * @param gLinkParam gLinkParam
     * @return Result
     * @throws Exception 编译异常
     */
    Result<String> addGLink(String userId, GLinkParam gLinkParam) throws Exception;

    /**
     *
     * @param userId userId
     * @param gLinkParam gLinkParam
     * @return Result
     * @throws Exception  编译异常
     */
    Result<String> editGLink(String userId, GLinkParam gLinkParam) throws Exception;

    /**
     *
     * @param userId userId
     * @param gLinkParam gLinkParam
     * @return  Result
     * @throws Exception 编译异常
     */
    Result<String> deleteGLink(String userId, GLinkParam gLinkParam) throws Exception;

    /**
     *
     * @param userId userId
     * @param rid rid
     * @param params params
     * @return Result
     */
    Result<String> getModuleInfo(String userId,String rid, String params);

    /**
     *
     * @param userId userId
     * @param rid rid
     * @param params params
     * @return Result
     */
    Result<String> getCoreInfo(String userId,String rid, String params);

    /**
     *
     * @param userId userId
     * @param rid rid
     * @param params params
     * @return Result
     */
    Result<String> getAllStatus(String userId,String rid, String params);

    /**
     *
     * @param userId userId
     * @param switchCodeParam switchCodeParam
     * @return Result
     */
    Result<String> switchCodec(String userId, SwitchCodeParam switchCodeParam);

    /**
     *
     * @param userId userId
     * @param switchPackEncoderSourceParam switchPackEncoderSourceParam
     * @return Result
     */
    Result<String> switchPackEncoderSource(String userId, SwitchPackEncoderSourceParam switchPackEncoderSourceParam);

    /**
     *
     * @param userId userId
     * @param rid rid
     * @param params params
     * @return Result
     */
    Result<String> getCommandConfig(String userId,String rid, String params);

    /**
     *
     * @param userId userId
     * @param params params
     * @return Result
     */
    Result<String> updateCommandConfig(String userId, UpdateCommandConfigParam params);

    /**
     *
     * @param userId userId
     * @param rid rid
     * @param params params
     * @return Result
     */
    Result<String> getBitrateRange(String userId,String rid, String params);

    /**
     *
     * @param userId userId
     * @param rid rid
     * @return Result
     */
    Result<String> queryConfig(String userId,String rid);

    /**
     *
     * @param userId userId
     * @param switchAreaParam switchAreaParam
     * @return Result
     */
    Result<String> switchArea(String userId, SwitchAreaParam switchAreaParam);

    /**
     *
     * @param userId userId
     * @param switchAreaParam switchAreaParam
     * @return Result
     */
    Result<String> coreInfo(String userId, SwitchAreaParam switchAreaParam);

    /**
     *
     * @param userId userId
     * @param liveVoipParam liveVoipParam
     * @return Result
     */
    Result<String> setLiveVoIP(String userId, LiveVoipParam liveVoipParam);

    /**
     *
     * @param userId userId
     * @param switchAreaParam switchAreaParam
     * @return Result
     */
    Result<String> getLiveVoIP(String userId, SwitchAreaParam switchAreaParam);

    /**
     *
     * @param userId userId
     * @param voipVolumeParam voipVolumeParam
     * @return Result
     */
    Result<String> getVoipVolume(String userId, VoipVolumeParam voipVolumeParam);

    /**
     *
     * @param userId userId
     * @param voipVolumeParam voipVolumeParam
     * @return Result
     */
    Result<String> getGridEncodeVideoUrl(String userId, VoipVolumeParam voipVolumeParam);

    /**
     *
     * @param extendExternal extendExternal
     * @throws Exception 编译异常
     */
    void updateExtentEernal(ExtendExternal extendExternal) throws Exception;

    /**
     * 调用R的接口并返回
     * @param rid rid
     * @param constant constant
     * @return Result
     */
    Result command(String rid, CommandConstant constant);

    /**
     * 重启linuxR或重复LinuxR所在的机器
     * @param rid rid
     * @param operate operate
     * @return Result
     */
    Result restartOrRebootLinuxR(String rid, CommandConstant operate);

    /**
     *
     * @param rid rid
     * @param operate operate
     * @return Result
     */
    Result getEcoPreviewInfo(String rid, CommandConstant operate);

    /**
     *
     * @param rid rid
     * @param operate operate
     * @param data Data
     * @return Result
     */
    Result ecoPreview(String rid, CommandConstant operate,String data);

    /**
     *
     * @param rid rid
     * @param exitEcoPreview exitEcoPreview
     * @return  Result
     */
    Result exitEcoPreviewInfo(String rid, CommandConstant exitEcoPreview);

    /**
     *
     * @param rid rid
     * @param exitEcoPreview exitEcoPreview
     * @param data data
     * @return Result
     */
    Result getEncoderLogo(String rid, CommandConstant exitEcoPreview,String data);

    /**
     * 获取R的小版本
     * @param peerId peerId
     * @param operate operate
     * @return Result
     */
    Result getVersionR(String peerId, CommandConstant operate);

    /**
     * R和Grid在live之前,发送slug信息至tvu-search
     * @param userId userId
     * @param param  参数
     * @return 是否发送信息成功,如失败,给到错误码
     */
    Result<String> gridAndReceiverSendMessageToSearch(String userId, SendSlugMessageParam param);

   /* *//**
     * 根据 externalId 删除slug信息
     * @param userId userId
     * @param param 参数
     * @return 是否删除信息成功,如失败,给到错误码
     *//*
    Result<String> deleteGridSlug(String userId, SendSlugMessageParam param);*/

    /**
     * 通过Grid查询最新的slug信息

     * @param sourceId  Gird id
     * @throws Exception  编译异常
     * @return slug信息
     */
    Result<String> getSlugByGridId( String sourceId) throws Exception;
}
